package com.carlinfo.stu_ques.question.pojo;

import java.io.Serializable;
import java.util.Date;

import com.carlinfo.stu_ques.users.pojo.Students;

/**
 * 答案 属性:id,学生id,答案,是否正确,创建时间,结束时间
 * 
 * @author wll
 */
public class Answer implements Serializable
{
	private int id;
	private int stuId;
	private Students students;
	private int questionId;
	private boolean shiFou;
	private String jieGuo;
	private Date createTime;
	private Date endTime;
	private Question question;

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public int getStuId()
	{
		return stuId;
	}

	public void setStuId(int stuId)
	{
		this.stuId = stuId;
	}
	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getEndTime()
	{
		return endTime;
	}

	public void setEndTime(Date endTime)
	{
		this.endTime = endTime;
	}

	public String toString()
	{
		String questionName = "无";
		String studentName = "无";
		String res = getJieGuo();
		if (getQuestion() != null)
		{
			questionName = getQuestion().getName();
			if(questionName.length()>3) {
				questionName = questionName.substring(0, 3)+"...";
			}
		}
		if (getStudents() != null)
		{
			studentName = getStudents().getName();
		}
		if(res.length()>3) {
			res= res.substring(0,3)+"...";
		}
		String result = getId() + "\t" + questionName + "\t"+res+"\t" + studentName + "\t" + (isShiFou() ? "正确" : "错误") + "\t\t"
				+ getCreateTime().toLocaleString() + "\t" + getEndTime().toLocaleString();
		return result;
	}

	public Students getStudents()
	{
		return students;
	}

	public void setStudents(Students students)
	{
		this.students = students;
	}

	public int getQuestionId()
	{
		return questionId;
	}

	public void setQuestionId(int questionId)
	{
		this.questionId = questionId;
	}

	public Question getQuestion()
	{
		return question;
	}

	public void setQuestion(Question question)
	{
		this.question = question;
	}

	public boolean isShiFou()
	{
		return shiFou;
	}

	public void setShiFou(boolean shiFou)
	{
		this.shiFou = shiFou;
	}

	public String getJieGuo()
	{
		return jieGuo;
	}

	public void setJieGuo(String jieGuo)
	{
		this.jieGuo = jieGuo;
	}
}
